我在迁移中有以下内容:create_table:model_with_a_long_namedo|t|t.references:other_model_with_an_equally_long_name,index:trueend对于Postgres,这会产生一个名称太长的索引。有没有办法手动指定索引名称(不用单独添加整数列和索引)?类似下面的内容:create_table:model_with_a_long_namedo|t|t.references:other_model_with_an_equally_long_name,index:true,index_name:'model_
我有以下数组[12,16,5,9,11,5,4]它打印:12,16,5,9,11,5,4.我希望它打印:4,5,11,9,5,16,12当我执行array.reverse时,它打印:4,5,11,9,5,61,21它颠倒了个人数字-知道我该如何阻止它吗? 最佳答案 a=[12,16,5,9,11,5,4]#=>[12,16,5,9,11,5,4]a.reverse#=>[4,5,11,9,5,16,12]我没有看到你所看到的。编辑:根据Ben注意到的展开,您可能正在反转字符串。"12,16,5,9,11,5,4".reverse#=